package com.yanxin.grpc.proto.activity;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.25.0)",
    comments = "Source: activity_service.proto")
public final class rpaGrpc {

  private rpaGrpc() {}

  public static final String SERVICE_NAME = "rpa.rpa";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<com.yanxin.grpc.proto.activity.run_args,
      com.yanxin.grpc.proto.activity.log> getRunMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "run",
      requestType = com.yanxin.grpc.proto.activity.run_args.class,
      responseType = com.yanxin.grpc.proto.activity.log.class,
      methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
  public static io.grpc.MethodDescriptor<com.yanxin.grpc.proto.activity.run_args,
      com.yanxin.grpc.proto.activity.log> getRunMethod() {
    io.grpc.MethodDescriptor<com.yanxin.grpc.proto.activity.run_args, com.yanxin.grpc.proto.activity.log> getRunMethod;
    if ((getRunMethod = rpaGrpc.getRunMethod) == null) {
      synchronized (rpaGrpc.class) {
        if ((getRunMethod = rpaGrpc.getRunMethod) == null) {
          rpaGrpc.getRunMethod = getRunMethod =
              io.grpc.MethodDescriptor.<com.yanxin.grpc.proto.activity.run_args, com.yanxin.grpc.proto.activity.log>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "run"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.yanxin.grpc.proto.activity.run_args.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.yanxin.grpc.proto.activity.log.getDefaultInstance()))
              .setSchemaDescriptor(new rpaMethodDescriptorSupplier("run"))
              .build();
        }
      }
    }
    return getRunMethod;
  }

  private static volatile io.grpc.MethodDescriptor<com.yanxin.grpc.proto.activity.control_args,
      com.yanxin.grpc.proto.activity.control_response> getControlMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "control",
      requestType = com.yanxin.grpc.proto.activity.control_args.class,
      responseType = com.yanxin.grpc.proto.activity.control_response.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor<com.yanxin.grpc.proto.activity.control_args,
      com.yanxin.grpc.proto.activity.control_response> getControlMethod() {
    io.grpc.MethodDescriptor<com.yanxin.grpc.proto.activity.control_args, com.yanxin.grpc.proto.activity.control_response> getControlMethod;
    if ((getControlMethod = rpaGrpc.getControlMethod) == null) {
      synchronized (rpaGrpc.class) {
        if ((getControlMethod = rpaGrpc.getControlMethod) == null) {
          rpaGrpc.getControlMethod = getControlMethod =
              io.grpc.MethodDescriptor.<com.yanxin.grpc.proto.activity.control_args, com.yanxin.grpc.proto.activity.control_response>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "control"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.yanxin.grpc.proto.activity.control_args.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.yanxin.grpc.proto.activity.control_response.getDefaultInstance()))
              .setSchemaDescriptor(new rpaMethodDescriptorSupplier("control"))
              .build();
        }
      }
    }
    return getControlMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static rpaStub newStub(io.grpc.Channel channel) {
    return new rpaStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static rpaBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new rpaBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static rpaFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new rpaFutureStub(channel);
  }

  /**
   */
  public static abstract class rpaImplBase implements io.grpc.BindableService {

    /**
     */
    public void run(com.yanxin.grpc.proto.activity.run_args request,
        io.grpc.stub.StreamObserver<com.yanxin.grpc.proto.activity.log> responseObserver) {
      asyncUnimplementedUnaryCall(getRunMethod(), responseObserver);
    }

    /**
     */
    public void control(com.yanxin.grpc.proto.activity.control_args request,
        io.grpc.stub.StreamObserver<com.yanxin.grpc.proto.activity.control_response> responseObserver) {
      asyncUnimplementedUnaryCall(getControlMethod(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getRunMethod(),
            asyncServerStreamingCall(
              new MethodHandlers<
                com.yanxin.grpc.proto.activity.run_args,
                com.yanxin.grpc.proto.activity.log>(
                  this, METHODID_RUN)))
          .addMethod(
            getControlMethod(),
            asyncUnaryCall(
              new MethodHandlers<
                com.yanxin.grpc.proto.activity.control_args,
                com.yanxin.grpc.proto.activity.control_response>(
                  this, METHODID_CONTROL)))
          .build();
    }
  }

  /**
   */
  public static final class rpaStub extends io.grpc.stub.AbstractStub<rpaStub> {
    private rpaStub(io.grpc.Channel channel) {
      super(channel);
    }

    private rpaStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected rpaStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new rpaStub(channel, callOptions);
    }

    /**
     */
    public void run(com.yanxin.grpc.proto.activity.run_args request,
        io.grpc.stub.StreamObserver<com.yanxin.grpc.proto.activity.log> responseObserver) {
      asyncServerStreamingCall(
          getChannel().newCall(getRunMethod(), getCallOptions()), request, responseObserver);
    }

    /**
     */
    public void control(com.yanxin.grpc.proto.activity.control_args request,
        io.grpc.stub.StreamObserver<com.yanxin.grpc.proto.activity.control_response> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getControlMethod(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class rpaBlockingStub extends io.grpc.stub.AbstractStub<rpaBlockingStub> {
    private rpaBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private rpaBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected rpaBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new rpaBlockingStub(channel, callOptions);
    }

    /**
     */
    public java.util.Iterator<com.yanxin.grpc.proto.activity.log> run(
        com.yanxin.grpc.proto.activity.run_args request) {
      return blockingServerStreamingCall(
          getChannel(), getRunMethod(), getCallOptions(), request);
    }

    /**
     */
    public com.yanxin.grpc.proto.activity.control_response control(com.yanxin.grpc.proto.activity.control_args request) {
      return blockingUnaryCall(
          getChannel(), getControlMethod(), getCallOptions(), request);
    }
  }

  /**
   */
  public static final class rpaFutureStub extends io.grpc.stub.AbstractStub<rpaFutureStub> {
    private rpaFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private rpaFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected rpaFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new rpaFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<com.yanxin.grpc.proto.activity.control_response> control(
        com.yanxin.grpc.proto.activity.control_args request) {
      return futureUnaryCall(
          getChannel().newCall(getControlMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_RUN = 0;
  private static final int METHODID_CONTROL = 1;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final rpaImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(rpaImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_RUN:
          serviceImpl.run((com.yanxin.grpc.proto.activity.run_args) request,
              (io.grpc.stub.StreamObserver<com.yanxin.grpc.proto.activity.log>) responseObserver);
          break;
        case METHODID_CONTROL:
          serviceImpl.control((com.yanxin.grpc.proto.activity.control_args) request,
              (io.grpc.stub.StreamObserver<com.yanxin.grpc.proto.activity.control_response>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class rpaBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    rpaBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.yanxin.grpc.proto.activity.ActivityProto.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("rpa");
    }
  }

  private static final class rpaFileDescriptorSupplier
      extends rpaBaseDescriptorSupplier {
    rpaFileDescriptorSupplier() {}
  }

  private static final class rpaMethodDescriptorSupplier
      extends rpaBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    rpaMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (rpaGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new rpaFileDescriptorSupplier())
              .addMethod(getRunMethod())
              .addMethod(getControlMethod())
              .build();
        }
      }
    }
    return result;
  }
}
